package com.liyunc.demo.comp.id.generate.config;

import com.liyunc.demo.comp.id.generate.service.SingIdGenerator;
import com.liyunc.demo.comp.id.generate.service.impl.SnowFlakeIdWorker;
import com.liyunc.demo.comp.id.generate.service.impl.SnowFlakeIdentifierGeneratorStrategyProvider;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liyuncong
 * @version 1.0
 * @file SnowFlakeConfiguration.java
 * @brief SnowFlakeConfiguration
 * @details SnowFlakeConfiguration
 * @date 2022-04-08
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                        NAME               DESCRIPTION
 * 2022-04-08                      liyuncong          Created
 */
@Configuration
@EntityScan("com.liyunc.comp.id.generate")
public class SnowFlakeConfiguration {

    @Bean
    public SingIdGenerator providerIdGenerate() {
        return new SnowFlakeIdWorker();
    }

    @Bean
    public SnowFlakeIdentifierGeneratorStrategyProvider snowFlakeGeneratorStrategyProvider() {
        return new SnowFlakeIdentifierGeneratorStrategyProvider();
    }
}
